package View.SetupScreens;
import java.awt.Color;
import java.awt.Dimension;
import java.awt.Font;

import javax.swing.JButton;
import javax.swing.JLabel;
import javax.swing.JPanel;

import Model.Game;
import Model.Player;
import javax.swing.SwingConstants;

/**
 * Creates the summary screen which follows the setup GUI screens
 * @author Matthew Miller
 */
public class GameStats extends JPanel {
	
	private Game game;
	public JButton startGameBtn;
	
	/**
	 * Constructs the components for the panel.
	 * @param game
	 */
	public GameStats(final Game game) {
		this.game = game;
		
		setBackground(Color.BLACK);
		setLayout(null);
		setPreferredSize(new Dimension(1200, 800));
		
		JLabel title = new JLabel("GAME INFORMATION");
		title.setHorizontalAlignment(SwingConstants.CENTER);
		title.setFont(new Font("Helvetica", Font.BOLD, 65));
		title.setForeground(new Color(204, 153, 0));
		title.setSize(740, 100);
		title.setLocation(230, 73);
		
		add(title);
		
		startGameBtn = new JButton("START GAME");
		startGameBtn.setFont(new Font("Helvetica", Font.BOLD, 65));
		startGameBtn.setForeground(new Color(204, 153, 0));
		startGameBtn.setSize(900, 100);
		startGameBtn.setLocation(95, 241);
		
		add(startGameBtn);

	}
	
	/**
	 * Instantiates JLabels that show game information and adds them to the panel.
	 */
	public void updateStats()
	{
		JLabel mapType = new JLabel("THE MAPTYPE IS " + game.getMapType());
		mapType.setFont(new Font("Helvetica", Font.BOLD, 20));
		mapType.setForeground(new Color(204, 153, 0));
		mapType.setSize(900, 30);
		mapType.setLocation(300, 215);
		
		JLabel difficulty = new JLabel("THE DIFFICULTY IS " + game.getDifficulty());
		difficulty.setFont(new Font("Helvetica", Font.BOLD, 20));
		difficulty.setForeground(new Color(204, 153, 0));
		difficulty.setSize(900, 30);
		difficulty.setLocation(300, 265);
		
		JLabel number = new JLabel("THE NUMBER OF HUMAN PLAYERS IS " + game.getHumanPlayerCount());
		number.setFont(new Font("Helvetica", Font.BOLD, 20));
		number.setForeground(new Color(204, 153, 0));
		number.setSize(900, 30);
		number.setLocation(300, 315);
		
		Player[] players = game.getPlayers();
		
		JLabel p1Race = new JLabel("THE RACE OF PLAYER 1 IS  " + players[0].getRace() + " COLOR IS " + players[0].getColor()
													+ " AND NAME IS " + players[0].getName());
		p1Race.setFont(new Font("Helvetica", Font.BOLD, 20));
		p1Race.setForeground(new Color(204, 153, 0));
		p1Race.setSize(900, 30);
		p1Race.setLocation(300, 365);
		

		
		JLabel p2Race = new JLabel("THE RACE OF PLAYER 2 IS  " + players[1].getRace() + " COLOR IS " + players[1].getColor()
													+ " AND NAME IS " + players[1].getName());
		p2Race.setFont(new Font("Helvetica", Font.BOLD, 20));
		p2Race.setForeground(new Color(204, 153, 0));
		p2Race.setSize(900, 30);
		p2Race.setLocation(300, 415);
		
		JLabel p3Race = new JLabel("THE RACE OF PLAYER 3 IS  " + players[2].getRace() + " COLOR IS " + players[2].getColor()
													+ " AND NAME IS " + players[2].getName());
		p3Race.setFont(new Font("Helvetica", Font.BOLD, 20));
		p3Race.setForeground(new Color(204, 153, 0));
		p3Race.setSize(900, 30);
		p3Race.setLocation(300, 465);
		
		JLabel p4Race = new JLabel("THE RACE OF PLAYER 4 IS  " + players[3].getRace() + " COLOR IS " + players[3].getColor()
										+ " AND NAME IS " + players[3].getName());
		p4Race.setFont(new Font("Helvetica", Font.BOLD, 20));
		p4Race.setForeground(new Color(204, 153, 0));
		p4Race.setSize(900, 30);
		p4Race.setLocation(300, 515);
		
		
		add(mapType);
		add(difficulty);
		add(number);
		add(p1Race);
		add(p2Race);
		add(p3Race);
		add(p4Race);
	}
}
